/*import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

*//**
 * Created with IntelliJ IDEA.
 * Description:
 * User:
 * Date: 2025-04-20
 * Time: 16:13
 *//*
class MyThreadPool{
    private BlockingQueue<Runnable> queue = null;

    public MyThreadPool(int n){
        //初始化线程池，创建固定个数的线程
        queue = new ArrayBlockingQueue<>(1000);

        //创建N个线程
        for (int i = 0; i < n; i++) {
            Thread t = new Thread(() -> {
                try{
                    while(true){
                        Runnable task = queue.take();
                        task.run();
                    }
                }catch(InterruptedException e){
                    e.printStackTrace();
                }
            });
            t.start();
        }
    }

    public void submit(Runnable task) throws InterruptedException {
        queue.put(task);
    }
}

public class demo1 {
    public static void main(String[] args) throws InterruptedException {
        MyThreadPool pool = new MyThreadPool(10);

        for (int i = 0; i < 100; i++) {
            int id = i;
            pool.submit(() -> {
                System.out.println(Thread.currentThread().getName() + " id:" + id);
            });
        }
    }
}*/
